$('.right-titleicon').on("click",function(e){
	projectVM.showMenulist()
})
let that;
projectVM = new Vue({
	el: "#content",
	data: {
		showSelect:false,
		menuList:[
			{name:'投入',path:'goIn.html'},{name:'退出',path:'goOut.html'},{name:'列表',path:'index.html'},
		],
		typeList:[{name:'变压器1'},{name:'变压器2'},{name:'变压器3'},{name:'变压器4'},],
		showSubmit:false,
		onStatus:'',
		selectText:'变压器1',
		result:'',
		showMenu:false,
		showMorebtn:false,
		advance:'',
		showAdd:false,
		show_popup:false,
		listIn:[],//投入设备List
		listOut:[],//退出设备List
		workId:"",
	},
	created: function() {
		that = this;
		setTimeout(that.getInDetail,500);
	},
	methods: {
		//根据综合查询获取 详情
		getDetFromWorkId(){
			let config = mui.neioConfig.getNeioConfig();
			let url = config.URL.queryNetDeviceInfoByWorkId;
			//详情数据的Key
			console.log("OPOPOP:"+localStorage.getItem('neiosGoDetail'))
			let items = JSON.parse(localStorage.getItem('neiosGoDetail'));
			that.workId = items.obj.workId
			let param = {};
			param.workId = that.workId
			mui.neiosRequst.httpRequst(url,param,function(ret){
				console.log("列表返回："+JSON.stringify(ret))
				if(ret.code == 0){
					mui.toast(ret.msg)
					if(items.obj.workType = "0204"){
						that.listIn = ret.data;
					}
					if(items.obj.workType = "0209"){
						that.listOut = ret.data;
					}
				}
				if( ret.code == 1){
					mui.toast(ret.msg)
				}
			},function(err){
				console.log("失败回掉："+JSON.stringify(err))
			})
		},
		//获取设备投入 详情
		getInDetail(){
			let config = mui.neioConfig.getNeioConfig();
			let url = config.URL.queryNetDeviceInfoById;
			//详情数据的Key
			let key = config.KEYS.NET_WORK_DETAIL;
			let mData = mui.neioConfig.getStorage(key);
			// if(mData == ""){
			// 	that.getDetFromWorkId()
			// 	return;
			// }
			console.log("PP:"+JSON.stringify(mData))
			let data = JSON.parse(mData);
			let param = {};
			param.inOperateId = data.inOperateId;//投入设备ID
			param.deviceCode = data.deviceCode;//设备编码
			//清空 缓存
			mui.neioConfig.setStorage(key,"");
			mui.neiosRequst.httpRequst(url,param,function(ret){
				console.log("列表返回："+JSON.stringify(ret))
				if(ret.code == 0){
					mui.toast(ret.msg)
					that.listIn = ret.data;
					that.getOutDetail(data)
				}
				if( ret.code == 1){
					mui.toast(ret.msg)
				}
			},function(err){
				console.log("失败回掉："+JSON.stringify(err))
			})
		},
		//获取 设备退出详情
		getOutDetail(data){
			let config = mui.neioConfig.getNeioConfig();
			let url = config.URL.queryNetDeviceInfoById;
			let param = {};
			param.outOperateId = data.outOperateId;//退出设备ID
			param.deviceCode = data.deviceCode;//设备编码
			//清空数据
			let key = config.KEYS.NET_WORK_DETAIL;
			let mData = mui.neioConfig.setStorage(key,"");
			mui.neiosRequst.httpRequst(url,param,function(ret){
				console.log("列表返回："+JSON.stringify(ret))
				if(ret.code == 0){
					mui.toast(ret.msg)
					let datas = ret;
					that.listOut = datas.data;
				}
				if( ret.code == 1){
					mui.toast(ret.msg)
				}
			},function(err){
				console.log("失败回掉："+JSON.stringify(err))
			})
		},
		//返回上一页
		goBack(){
			mui.back()
		},
		//更多按钮
		showMore(){
			this.showMorebtn ? this.showMorebtn = false : this.showMorebtn = true
		},
		//阻止事件冒泡
		clickStop(){

		},
		//选择是否为值班人
		checkOnstatus(){
			console.log(this.onStatus)
			this.onStatus ? this.onStatus = false : this.onStatus =true
			
		},
		//点击菜单
		menuClick(e){
			if(e.name == '我值班'){
				this.onStatus? this.onStatus= false : this.onStatus=true
			}else{
				this.navTo(e.path)
			}
		},
		//左上角菜单显示隐藏
		showMenulist(){
			this.showMenu?this.showMenu=false:this.showMenu=true
		},
		navTo(e){
			mui.openWindow({
					url: e,
					id: e,
			});
			}
	},
	
	})